//
//  HLStatusesUser.m
//  weibo-OC
//
//  Created by 黄力 on 15/12/21.
//  Copyright © 2015年 HLTest. All rights reserved.
//

#import "HLStatusesUser.h"

@implementation HLStatusesUser

+ (instancetype)statusesUserWithDictionary:(NSDictionary *)dic {
    //创建对象
    HLStatusesUser *statusesUser = [[HLStatusesUser alloc] init];
    //字典转模型
    [statusesUser setValuesForKeysWithDictionary:dic];
    //返回
    return statusesUser;
}

//抛出未找到的key
- (void)setValue:(id)value forUndefinedKey:(NSString *)key {}

//头像地址
- (NSURL *)avatar_url {
    return [NSURL URLWithString:_avatar_large];
}

//认证图像
// 认证类型，-1：没有认证，0，认证用户，2,3,5: 企业认证，220: 达人
- (UIImage *)verified_Image {
    //根据认证类型来判断返回值
    if (_verified_type == 0) {
        return [UIImage imageNamed:@"avatar_vip"];
    }else if (_verified_type == 2 || _verified_type == 3 || _verified_type == 5) {
        return [UIImage imageNamed:@"avatar_enterprise_vip"];
    }else if (_verified_type == 220) {
        return [UIImage imageNamed:@"avatar_grassroot"];
    }else {
        return nil;
    }
}

//会员图像
- (UIImage *)vipImage {
    if (_mbrank != 0) {
        return [UIImage imageNamed:[NSString stringWithFormat:@"common_icon_membership_level%ld",_mbrank]];
    }else {
        return [UIImage imageNamed:@"common_icon_membership_expired"];
    }
}

@end
